home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-05-11 | 2.6 KB | 77 lines | [TEXT/PJMM] |
- unit PlatformGlobals;
-
- interface
-
- uses
- {$ifc UNDEFINED THINK_PASCAL}
- Types, QuickDraw, Menus, Windows, TextEdit, Fonts,{}
- Dialogs, Memory, Events,{}
- {$endc}
- SAT;
-
- {Variation on the Sprite record.}
- type
- PlSpritePtr = ^PlSprite;
- PlSprite = record
- { Variables that you should change as appropriate }
- kind: Integer; { Used for identification. >0: friend. <0 foe }
- position: Point;
- hotRect, hotRect2: Rect; { Tells how large the sprite is; hotRect is centered around origo }
- {hotRect is set by you. hotRect2 is offset to the current position.}
- face: FacePtr; { Pointer to the Face (appearance) to be used. }
- task: ProcPtr; { Callback-routine, called once per frame. If task=nil, the sprite is removed. }
- hitTask: ProcPtr; { Callback in collisions. }
- destructTask: ProcPtr; { Called when a sprite is disposed. (Usually nil.) }
- clip: RgnHandle; {Clip region to be used when this sprite is drawn.}
- { SAT variables that you shouldn't change: }
- oldpos: Point; {The 'task' routine is not allowed to change this! }
- next, prev: SpritePtr; {You may change them in your own sorting routine, but be careful if you do.}
- r, oldr: Rect; {Rectangle telling where to draw. Avoid messing with it.}
- oldFace: FacePtr; {Used by RunSAT2}
- dirty: Boolean; {Used by RunSAT2}
- {Variables for internal use by the sprites. Use as you please. Edit as necessary - this is merely a default}
- {set, enough space for most cases - but if you change the size of the record, call SetSpriteSize immediately}
- {after initializing (before any sprites are created)!}
- layer: integer; {For layer-sorting. When not used for that, use freely.}
- speed: Point; { Can be used for speed, but not necessarily. }
- mode: integer; { Usually used for different modes and/or to determine what image to show next. }
- worldPosition: Point;
- action, jumpKey: Integer;
- appPtr: Ptr; {Pointer for use by the application - i.e. pointer to extra data}
- { appLong: Longint; {Longint for free use by the application.}
- end;
-
- (* Actions *)
- const
- ActionMsgNumber = 5;
-
- Stand = 0; {id=128}
- StandOnHMovPlatform = 1; {id=129 the player stands on HMov so he gets his speedH}
- Jump = 2; {id=130}
- JumpFromHMov = 3; {id=131 jump from HMov Platform}
- Fall = 4; {id=132}
-
- (* JumpKey *)
- Pushed = 1;
- NotPushed = 0;
-
- type
- MovPlatRec = record
- MaxV, MinV: Integer;
- MaxH, MinH: Integer;
- filled: Integer; {/ / unused }
- end;
- MovPlatP = ^MovPlatRec;
-
- function IsPressed (k: Integer): Boolean;
-
- implementation
-
- function IsPressed (k: Integer): Boolean;
- var
- km: KeyMap;
- begin
- GetKeys(km);
- IsPressed := km[k];
- end;
- end.